﻿using System.Collections.Generic;
using Sedge.Core.Execution.ReportElements;

namespace Sedge.Core.Configuration.Report
{
	class TempSource : ISource
	{
		private Suite _suite;
		private readonly string _name;
		public string Caption { get; set; }

		public TempSource(string name)
		{
			_name = name;
		}

		public void PrepareSource(Suite suite)
		{
			_suite = suite;
		}

		public List<IReportElement> GetReportElements()
		{
            if (_suite.TempData.ContainsKey(_name))
            {
            	_suite.TempData[_name].Header = Caption;
                return new List<IReportElement> { _suite.TempData[_name] };
            }
			return new List<IReportElement>();
		}
	}
}
